package com.futvan.z.framework.core;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 跨域配置
 */
@Configuration
@EnableWebMvc
public class CrossDomainConfig implements WebMvcConfigurer {
    @Override
    public void addCorsMappings(CorsRegistry registry) {
        if("true".equals(z.sp.get("isCrossDomain"))){
            registry.addMapping("/**");
            WebMvcConfigurer.super.addCorsMappings(registry);
        }

    }
}
